package com.Sumcc.utils.ossUtil;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.AccessControlList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.InputStream;

/**
 * @author Sumcc
 * @date 2020/4/10
 */
public class OSSUtil {
    private static Logger logger = LoggerFactory.getLogger(OSSUtil.class);



    //上传到oss
    public static void ossUpload(String fileName, InputStream file){
        try {
            // 创建OSSClient实例。
//            OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
//            // 上传文件流。
//            ossClient.putObject(bucketName, fileName, file);
        }catch (Exception e){
            logger.error("上传文件异常:{}",e);
        }
    }
    //获取权限
    public static AccessControlList getAuth(){
        try {
            // 创建OSSClient实例。
//            OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
//            // 获取存储空间的访问权限。
//            AccessControlList acl = ossClient.getBucketAcl(bucketName);
//            System.out.println(acl.toString());
//            // 关闭OSSClient。
//            ossClient.shutdown();
//            return  acl;
            return  null;
        }catch (Exception e){
            logger.error("上传文件异常:{}",e);
            return null;
        }
    }
}
